fix Pyrefly infers Iterator[Any] instead of Iterator[int] for iter([0]) #3265 - #4227
Open
asukaminato0721 wants to merge 1 commit into
Open
fix Pyrefly infers Iterator[Any] instead of Iterator[int] for iter([0]) #3265#4227asukaminato0721 wants to merge 1 commit into
asukaminato0721 wants to merge 1 commit into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Contributor
|
This pull request has been imported. If you are a Meta employee, you can view this in D115174318. (Because this pull request was imported automatically, there will not be any future comments.) |
|
Diff from mypy_primer, showing the effect of this PR on open source code: cloud-init (https://github.com/canonical/cloud-init)
+ ERROR tests/unittests/config/test_cc_ssh.py:279:17-19: Cannot infer type of empty container; it will be treated as containing `Any` [implicit-any-empty-container]
cki-lib (https://gitlab.com/cki-project/cki-lib)
- ERROR cki_lib/metrics/server.py:23:12-24: Returned type `Iterator[Any]` is not assignable to declared return type `None` [bad-return]
+ ERROR cki_lib/metrics/server.py:23:12-24: Returned type `Iterator[Unknown]` is not assignable to declared return type `None` [bad-return]
setuptools (https://github.com/pypa/setuptools)
- ERROR setuptools/_distutils/tests/test_extension.py:91:33-57: Argument `Iterator[Any]` is not assignable to parameter `sources` with type `list[str]` in function `distutils.extension.Extension.__init__` [bad-argument-type]
+ ERROR setuptools/_distutils/tests/test_extension.py:91:33-57: Argument `Iterator[str]` is not assignable to parameter `sources` with type `list[str]` in function `distutils.extension.Extension.__init__` [bad-argument-type]
ibis (https://github.com/ibis-project/ibis)
+ ERROR ibis/backends/clickhouse/tests/test_operators.py:259:28-30: Cannot infer type of empty container; it will be treated as containing `Any` [implicit-any-empty-container]
pandas (https://github.com/pandas-dev/pandas)
- ERROR pandas/tests/indexes/multi/test_constructors.py:564:38-59: Argument `Iterator[Any]` is not assignable to parameter `iterables` with type `Sequence[Iterable[Hashable]]` in function `pandas.core.indexes.multi.MultiIndex.from_product` [bad-argument-type]
+ ERROR pandas/tests/indexes/multi/test_constructors.py:564:38-59: Argument `Iterator[list[str]]` is not assignable to parameter `iterables` with type `Sequence[Iterable[Hashable]]` in function `pandas.core.indexes.multi.MultiIndex.from_product` [bad-argument-type]
spack (https://github.com/spack/spack)
+ ERROR lib/spack/spack/package_base.py:1263:40-42: Cannot infer type of empty container; it will be treated as containing `Any` [implicit-any-empty-container]
schema_salad (https://github.com/common-workflow-language/schema_salad)
+ ERROR src/schema_salad/dlang_codegen.py:148:55-57: Cannot infer type of empty container; it will be treated as containing `Any` [implicit-any-empty-container]
- ERROR src/schema_salad/dlang_codegen.py:150:16-25: Implicit conversion of `str | Any` to `bool` is not allowed [implicit-bool]
+ ERROR src/schema_salad/dlang_codegen.py:150:16-25: Implicit conversion of `str | Unknown` to `bool` is not allowed [implicit-bool]
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3265
Prevented bounded generic Any from incorrectly contextually typing list literals.
Test Plan
add test